--驯服的牛不退化
AddComponentPostInit("domesticatable",function(self)
	local BecomeDomesticated_old =  self.BecomeDomesticated
	self.BecomeDomesticated = function (self)
		self.domesticationdecaypaused = true
		return BecomeDomesticated_old(self)
	end
	local OnLoad_old = self.OnLoad
	self.OnLoad = function(self, data)
		if data.domesticated then
			self.domesticationdecaypaused = true
		end
		return OnLoad_old(self, data)
	end
end)

local function ToggleDomesticationDecay(inst)
	if not inst.components.domesticatable:IsDomesticated() then--未驯服的
		inst.components.domesticatable:PauseDomesticationDecay(inst.components.saltlicker.salted or inst.components.sleeper:IsAsleep())
	else
		inst.components.domesticatable:PauseDomesticationDecay(true)
	end
end
		
AddPrefabPostInit("beefalo", function(inst)
	inst:ListenForEvent("saltchange", ToggleDomesticationDecay)
	inst:ListenForEvent("gotosleep", ToggleDomesticationDecay)
	inst:ListenForEvent("onwakeup", ToggleDomesticationDecay)
end)